package com.example.administrator.myapplication;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.EditText;

/**
 * Created by Administrator on 2018/1/3.
 */

public class Lookover extends Activity {
    private EditText etName,etMain,etTime;
    private ActivityManager am;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        setContentView(R.layout.lookover);
        am = ActivityManager.getInstance();
        am.addActivity(this);

        Intent intent = getIntent();
        String noteID = intent.getStringExtra("noteID");

        etMain = (EditText) findViewById(R.id.noteMain2);
        etName = (EditText) findViewById(R.id.noteName2);
        etTime = (EditText) findViewById(R.id.noteTime2);

        sqlListDBConnect sd = new sqlListDBConnect(Lookover.this);
        SQLiteDatabase sdb = sd.getReadableDatabase();
        Cursor c = sdb.query("note",new String []{"noteID","noteName","noteContent","noteTime"},"noteID = ?",new String []{noteID},null,null,null);
        while(c.moveToNext()){
            etName.setText(c.getString(c.getColumnIndex("noteName")));
            etMain.setText(c.getString(c.getColumnIndex("noteContent")));
            etTime.setText(c.getString(c.getColumnIndex("noteTime")));
        }
        c.close();
        sdb.close();
        sd.close();
        super.onCreate(savedInstanceState);
    }
}
